var number = parseInt(prompt("enter a number"));
var num = parseInt(number/2);
if (number == 2 || number == 3)
    console.log(number + " is a  prime number");
else if (number == 1)
    console.log(number + " is not a  prime number");
else {
  while(num > 1){
    if (number % num == 0)
    {
        console.log(number + " is not a  prime number");
        break;
    }
    if (num == 2)
        console.log(number + " is a  prime number");
    num -= 1;
  }
}